Compiling Haskell by Program Transformation: A Report from the Trenches
نویسنده
چکیده
Many compilers do some of their work by means of correctness-preserving, and hopefully performance-improving, program transformations. The Glasgow Haskell Compiler (GHC) takes this idea of \compilation by transformation" as its war-cry, trying to express as much as possible of the compilation process in the form of program transformations. This paper reports on our practical experience of the transformational approach to compilation, in the context of a substantial compiler.
منابع مشابه
Modular polymorphic defunctionalization
Defunctionalization is generally considered a whole-program transformation and thus incompatible with separate compilation. In this paper, we formalize a modular variant of defunctionalization which can support separate compilation for a functional programming language with parametric polymorphism. Our technique allows modules in a Haskell-like language to be separately defunctionalized and com...
متن کاملARITY ANALYSIS (Working Notes Only, Not Ready for Publication Yet)
Virtually every compiler performs transformations on the program it is compiling in an attempt to improve efficiency. However, a transformation known as “lambda floating” has not received much attention in the past. In this paper we describe an analysis on the arity of a function which determines the number of lambdas that can be floated out. We give detailed measurements of the effect in an op...
متن کاملCompiling APL to Accelerate Through a Typed IL
APL is a functional array programming language from the 1960’s. While APL no longer has widespread adoption as a general programming language, there still exist large codebases in APL in the industry. Accelerate is an array language embedded in Haskell for doing high-performance computation on GPU’s. In this report I present a compiler written in Haskell for compiling a typed intermediate array...
متن کاملLet--oating: Moving Bindings to Give Faster Programs
Virtually every compiler performs transformations on the program it is compiling in an attempt to improve eeciency. Despite their importance, however, there have been few systematic attempts to categorise such transformations and measure their impact. In this paper we describe a particular group of transformations | the \let-oating" transformations | and give detailed measurements of their eeec...
متن کاملThe GRIN Project: A Highly Optimising Back End for Lazy Functional Languages
Low level optimisations from conventional compiler technology often give very poor results when applied to code from lazy functional languages, mainly because of the completely diierent structure of the code, unknown control ow, etc. A novel approach to compiling laziness is needed. We describe a complete back end for lazy functional languages, which uses various interprocedural optimisations t...
متن کامل